import { Button, Space } from "antd"
import React from "react"

interface ToolbarProps {
	style?: React.CSSProperties
	buttons?: {
		label: string
		type?: "primary" | "dashed" | "link" | "text" | "default"
		disabled?: boolean
		onClick: () => void
	}[]
}

export const Toolbar: React.FC<ToolbarProps> = ({ buttons, style }) => {
	return (
		<Space style={style ? style : { display: "flex", justifyContent: "end" }}>
			{buttons &&
				buttons.map((button, index) => (
					<Button key={index} onClick={button.onClick} type={button.type || "primary"} disabled={button.disabled}>
						{button.label}
					</Button>
				))}
		</Space>
	)
}

export default Toolbar
